package com.lancoo.ccas52.mapper;

import java.util.Collection;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lancoo.ccas52.entity.Segment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.ccas52.config.MybatisRedisCache;
import com.lancoo.ccas52.pojo.common.GroupObject;
import com.lancoo.ccas52.pojo.vo.*;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 环节 Mapper 接口
 * </p>
 *
 * @author quin.song
 * @since 2023-01-03
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface SegmentMapper extends BaseMapper<Segment> {
    int addBatch(@Param("segmentCollection") Collection<Segment> segmentCollection);

    List<CollegeDto> getCollegeByTaskId(@Param("taskId") Integer taskId);



    /**
     * 获取环节类别
     *
     * @param taskId
     * @return
     */
    List<CourseTypeDto> getSegmentTypeByTaskId(@Param("taskId") Integer taskId);

    /**
     * @param taskId
     * @param page
     * @param applyStatus
     * @param segmentTypeId
     * @param collegeId
     * @param keyWord
     * @return
     */
    IPage<SegmentDto> getSegmentByConditions(@Param("taskId") Integer taskId, @Param("page") IPage page, @Param("applyStatus") Integer applyStatus, @Param("segmentTypeId") String segmentTypeId,
                                             @Param("collegeId") String collegeId, @Param("keyWord") String keyWord);

    /**
     * 获取环节申请信息用于统计数量
     * @param taskId
     * @return
     */
    List<SegmentDto> getSegmentApply(@Param("taskId") Integer taskId);

    /**
     * @param taskId
     * @param segmentTypeId
     * @param collegeId
     * @param keyWord
     * @return
     */
    List<Segment> getNotIsEnableApplySegment(@Param("taskId") Integer taskId, @Param("segmentTypeId") String segmentTypeId, @Param("collegeId") String collegeId, @Param("keyWord") String keyWord);

    /**
     * @param taskId
     * @param applyStatus
     * @param segmentTypeId
     * @param collegeId
     * @return
     */
    List<GroupObject<Number, Number>> getSegmentApplyStatistics(@Param("taskId") Integer taskId, @Param("applyStatus") Integer applyStatus, @Param("segmentTypeId") String segmentTypeId, @Param("collegeId") String collegeId);

    /**
     * @param taskId
     * @return
     */
    List<GroupObject<Integer, Long>> getPublishStatistics(@Param("taskId") Integer taskId);

    /**
     * 获取教学计划对应环节
     *
     * @param taskId
     * @param page
     * @param studyNature
     * @param segmentTypeId
     * @param collegeId
     * @param keyWord
     * @param state
     * @return
     */
    IPage<SegmentPlanDto> getSegmentPlanAndTeachingClass(@Param("taskId") Integer taskId, @Param("page") IPage page, @Param("studyNature") Integer studyNature, @Param("segmentTypeId") String segmentTypeId,
                                                         @Param("collegeId") String collegeId, @Param("keyWord") String keyWord, @Param("state") Integer state);

    List<SegmentPlanDto> segmentStatistics(@Param("taskId") Integer taskId);

    /**
     * 获取教学计划 环节
     * @param taskId
     * @return
     */
    List<SegmentPlanDto> getSegmentPlan(@Param("taskId") Integer taskId);

}
